<template>
  <vue-office-pdf class="viewer" v-if="fileType === 10" :src="getFileUrl(path)"
                  style="height: 100vh; border: none; box-shadow: none;"/>
  <vue-office-docx class="viewer"
                   v-if="fileType === 7"
                   :src="getFileUrl(path)"
                   style="height: 100vh;"
  />
  <vue-office-excel
      v-if="fileType === 8"
      :src="getFileUrl(path)"
      style="height: 100vh;"
  />
</template>
<script setup>
//引入相关样式

import VueOfficePdf from '@vue-office/pdf';
import VueOfficeDocx from '@vue-office/docx'
import VueOfficeExcel from '@vue-office/excel'
import {getFileUrl} from "@/hooks/file/sysfile";
import {useRoute, useRouter} from "vue-router";
import {onMounted, ref} from "vue";
import '@vue-office/docx/lib/index.css'
import '@vue-office/excel/lib/index.css'
const $route = useRoute()

const path = ref();
const fileType = ref();
onMounted(() => {
  path.value = $route.query.path
  fileType.value = Number($route.query.type)

})
</script>


<style scoped>
.viewer {
  /* 确保允许文本选择 */
  user-select: text !important;
  -webkit-user-select: text !important;

}
</style>